<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LINE 2 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LINE 6 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-6"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Module      :  System.Win32.Mem</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Copyright   :  (c) Alastair Reid, 1997-2003</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Maintainer  :  Esa Ilari Vuokko &lt;ei@vuokko.info&gt;</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Stability   :  provisional</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- A collection of FFI declarations for interfacing with Win32.</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Win32.Mem</span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">MEMORY_BASIC_INFORMATION</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">copyMemory</span><span>
</span><span id="line-23"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">moveMemory</span><span>
</span><span id="line-24"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fillMemory</span><span>
</span><span id="line-25"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">zeroMemory</span><span>
</span><span id="line-26"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">memset</span><span>
</span><span id="line-27"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getProcessHeap</span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="hs-pragma">{-# LINE 29 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getProcessHeaps</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-pragma">{-# LINE 31 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-31"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-32"></span><span>      </span><span class="hs-comment">-- * Global allocation</span><span>
</span><span id="line-33"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-34"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_INVALID_HANDLE</span><span>
</span><span id="line-35"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_FIXED</span><span>
</span><span id="line-36"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_MOVEABLE</span><span>
</span><span id="line-37"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gPTR</span><span>
</span><span id="line-38"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gHND</span><span>
</span><span id="line-39"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_DDESHARE</span><span>
</span><span id="line-40"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_SHARE</span><span>
</span><span id="line-41"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_LOWER</span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_NOCOMPACT</span><span>
</span><span id="line-43"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_NODISCARD</span><span>
</span><span id="line-44"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_NOT_BANKED</span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_NOTIFY</span><span>
</span><span id="line-46"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gMEM_ZEROINIT</span><span>
</span><span id="line-47"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">globalAlloc</span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">globalFlags</span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">globalFree</span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">globalHandle</span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">globalLock</span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">globalReAlloc</span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">globalSize</span><span>
</span><span id="line-54"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">globalUnlock</span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span>      </span><span class="hs-comment">-- * Heap allocation</span><span>
</span><span id="line-57"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span>
</span><span id="line-58"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hEAP_GENERATE_EXCEPTIONS</span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hEAP_NO_SERIALIZE</span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hEAP_ZERO_MEMORY</span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapAlloc</span><span>
</span><span id="line-62"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapCompact</span><span>
</span><span id="line-63"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapCreate</span><span>
</span><span id="line-64"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapDestroy</span><span>
</span><span id="line-65"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapFree</span><span>
</span><span id="line-66"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapLock</span><span>
</span><span id="line-67"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapReAlloc</span><span>
</span><span id="line-68"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapSize</span><span>
</span><span id="line-69"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapUnlock</span><span>
</span><span id="line-70"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">heapValidate</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span>      </span><span class="hs-comment">-- * Virtual allocation</span><span>
</span><span id="line-73"></span><span>      </span><span class="hs-comment">-- ** Allocation</span><span>
</span><span id="line-74"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualAlloc</span><span>
</span><span id="line-75"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualAllocEx</span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">VirtualAllocFlags</span><span>
</span><span id="line-77"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mEM_COMMIT</span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mEM_RESERVE</span><span>
</span><span id="line-79"></span><span>      </span><span class="hs-comment">-- ** Locking</span><span>
</span><span id="line-80"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualLock</span><span>
</span><span id="line-81"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualUnlock</span><span>
</span><span id="line-82"></span><span>      </span><span class="hs-comment">-- ** Protection</span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualProtect</span><span>
</span><span id="line-84"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualProtectEx</span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualQueryEx</span><span>
</span><span id="line-86"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-87"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pAGE_READONLY</span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pAGE_READWRITE</span><span>
</span><span id="line-89"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pAGE_EXECUTE</span><span>
</span><span id="line-90"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pAGE_EXECUTE_READ</span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pAGE_EXECUTE_READWRITE</span><span>
</span><span id="line-92"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pAGE_GUARD</span><span>
</span><span id="line-93"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pAGE_NOACCESS</span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pAGE_NOCACHE</span><span>
</span><span id="line-95"></span><span>      </span><span class="hs-comment">-- ** Freeing</span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualFree</span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">virtualFreeEx</span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">FreeFlags</span><span>
</span><span id="line-99"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mEM_DECOMMIT</span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mEM_RELEASE</span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign</span><span>
</span><span id="line-108"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.C.Types</span><span class="hs-cpp">

#include &quot;windows_cconv.h&quot;
</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-116"></span><span class="hs-comment">-- Data types</span><span>
</span><span id="line-117"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">MEMORY_BASIC_INFORMATION</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">MEMORY_BASIC_INFORMATION</span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">mbiBaseAddress</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mbiAllocationBase</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mbiAllocationProtect</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-123"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mbiRegionSize</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SIZE_T</span><span>
</span><span id="line-124"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mbiState</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-125"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mbiProtect</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-126"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mbiType</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-127"></span><span>    </span><span class="hs-special">}</span><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Show</span><span class="hs-special">)</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-130"></span><span class="hs-comment">-- Instances</span><span>
</span><span id="line-131"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier">Storable</span><span> </span><span class="hs-identifier">MEMORY_BASIC_INFORMATION</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-134"></span><span>    </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">48</span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span class="hs-pragma">{-# LINE 135 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-identifier">alignment</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">8</span><span>
</span><span id="line-136"></span><span class="hs-pragma">{-# LINE 136 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">mbi</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-137"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mbiBaseAddress</span><span> </span><span class="hs-identifier">mbi</span><span class="hs-special">)</span><span>
</span><span id="line-138"></span><span class="hs-pragma">{-# LINE 138 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-138"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span>    </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mbiAllocationBase</span><span> </span><span class="hs-identifier">mbi</span><span class="hs-special">)</span><span>
</span><span id="line-139"></span><span class="hs-pragma">{-# LINE 139 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-139"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mbiAllocationProtect</span><span> </span><span class="hs-identifier">mbi</span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span class="hs-pragma">{-# LINE 140 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-140"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">24</span><span class="hs-special">)</span><span class="hs-special">)</span><span>        </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mbiRegionSize</span><span> </span><span class="hs-identifier">mbi</span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span class="hs-pragma">{-# LINE 141 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-141"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span class="hs-special">)</span><span>             </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mbiState</span><span> </span><span class="hs-identifier">mbi</span><span class="hs-special">)</span><span>
</span><span id="line-142"></span><span class="hs-pragma">{-# LINE 142 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-142"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">36</span><span class="hs-special">)</span><span class="hs-special">)</span><span>           </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mbiProtect</span><span> </span><span class="hs-identifier">mbi</span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span class="hs-pragma">{-# LINE 143 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-143"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">40</span><span class="hs-special">)</span><span class="hs-special">)</span><span>              </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mbiType</span><span> </span><span class="hs-identifier">mbi</span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span class="hs-pragma">{-# LINE 144 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-145"></span><span>        </span><span class="hs-identifier">baseAddress</span><span>       </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span>
</span><span id="line-146"></span><span class="hs-pragma">{-# LINE 146 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-146"></span><span>        </span><span class="hs-identifier">allocationBase</span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span>    </span><span class="hs-identifier">buf</span><span>
</span><span id="line-147"></span><span class="hs-pragma">{-# LINE 147 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-147"></span><span>        </span><span class="hs-identifier">allocationProtect</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-148"></span><span class="hs-pragma">{-# LINE 148 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-148"></span><span>        </span><span class="hs-identifier">regionSize</span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">24</span><span class="hs-special">)</span><span class="hs-special">)</span><span>        </span><span class="hs-identifier">buf</span><span>
</span><span id="line-149"></span><span class="hs-pragma">{-# LINE 149 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-149"></span><span>        </span><span class="hs-identifier">state</span><span>             </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span class="hs-special">)</span><span>             </span><span class="hs-identifier">buf</span><span>
</span><span id="line-150"></span><span class="hs-pragma">{-# LINE 150 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-150"></span><span>        </span><span class="hs-identifier">protect</span><span>           </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">36</span><span class="hs-special">)</span><span class="hs-special">)</span><span>           </span><span class="hs-identifier">buf</span><span>
</span><span id="line-151"></span><span class="hs-pragma">{-# LINE 151 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-151"></span><span>        </span><span class="hs-identifier">ty</span><span>                </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">40</span><span class="hs-special">)</span><span class="hs-special">)</span><span>              </span><span class="hs-identifier">buf</span><span>
</span><span id="line-152"></span><span class="hs-pragma">{-# LINE 152 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-152"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">MEMORY_BASIC_INFORMATION</span><span> </span><span class="hs-identifier">baseAddress</span><span> </span><span class="hs-identifier">allocationBase</span><span> </span><span class="hs-identifier">allocationProtect</span><span> </span><span class="hs-identifier">regionSize</span><span> </span><span class="hs-identifier">state</span><span> </span><span class="hs-identifier">protect</span><span> </span><span class="hs-identifier">ty</span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span class="hs-identifier">copyMemory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-157"></span><span class="hs-identifier">copyMemory</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">nbytes</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">copyBytes</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">nbytes</span><span class="hs-special">)</span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span class="hs-identifier">moveMemory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-160"></span><span class="hs-identifier">moveMemory</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">nbytes</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">moveBytes</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">nbytes</span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span class="hs-identifier">fillMemory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">BYTE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span class="hs-identifier">fillMemory</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-identifier">nbytes</span><span> </span><span class="hs-identifier">val</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-164"></span><span>  </span><span class="hs-identifier">memset</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">val</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">nbytes</span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span class="hs-identifier">zeroMemory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span class="hs-identifier">zeroMemory</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-identifier">nbytes</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">memset</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">nbytes</span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;string.h&quot;</span><span> </span><span class="hs-identifier">memset</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CInt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span>
</span><span id="line-171"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetProcessHeap&quot;</span><span>
</span><span id="line-172"></span><span>  </span><span class="hs-identifier">getProcessHeap</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-173"></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span class="hs-pragma">{-# LINE 175 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-175"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetProcessHeaps&quot;</span><span>
</span><span id="line-176"></span><span>  </span><span class="hs-identifier">getProcessHeaps</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span class="hs-pragma">{-# LINE 178 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span class="hs-keyword">type</span><span>   </span><span class="hs-identifier">HGLOBAL</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span class="hs-identifier">gMEM_INVALID_HANDLE</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-184"></span><span class="hs-identifier">gMEM_INVALID_HANDLE</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">32768</span><span>
</span><span id="line-185"></span><span class="hs-pragma">{-# LINE 185 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-185"></span><span>
</span><span id="line-186"></span><span class="hs-identifier">gMEM_FIXED</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-187"></span><span class="hs-identifier">gMEM_FIXED</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-188"></span><span class="hs-identifier">gMEM_MOVEABLE</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-189"></span><span class="hs-identifier">gMEM_MOVEABLE</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-190"></span><span class="hs-identifier">gPTR</span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-191"></span><span class="hs-identifier">gPTR</span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-192"></span><span class="hs-identifier">gHND</span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-193"></span><span class="hs-identifier">gHND</span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">66</span><span>
</span><span id="line-194"></span><span class="hs-identifier">gMEM_DDESHARE</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-195"></span><span class="hs-identifier">gMEM_DDESHARE</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8192</span><span>
</span><span id="line-196"></span><span class="hs-identifier">gMEM_SHARE</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-197"></span><span class="hs-identifier">gMEM_SHARE</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8192</span><span>
</span><span id="line-198"></span><span class="hs-identifier">gMEM_LOWER</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-199"></span><span class="hs-identifier">gMEM_LOWER</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4096</span><span>
</span><span id="line-200"></span><span class="hs-identifier">gMEM_NOCOMPACT</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-201"></span><span class="hs-identifier">gMEM_NOCOMPACT</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-202"></span><span class="hs-identifier">gMEM_NODISCARD</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-203"></span><span class="hs-identifier">gMEM_NODISCARD</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-204"></span><span class="hs-identifier">gMEM_NOT_BANKED</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-205"></span><span class="hs-identifier">gMEM_NOT_BANKED</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4096</span><span>
</span><span id="line-206"></span><span class="hs-identifier">gMEM_NOTIFY</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-207"></span><span class="hs-identifier">gMEM_NOTIFY</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16384</span><span>
</span><span id="line-208"></span><span class="hs-identifier">gMEM_ZEROINIT</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-209"></span><span class="hs-identifier">gMEM_ZEROINIT</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span class="hs-pragma">{-# LINE 200 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-200"></span><span>
</span><span id="line-201"></span><span class="hs-identifier">globalAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-202"></span><span class="hs-identifier">globalAlloc</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-203"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;GlobalAlloc&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GlobalAlloc</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">size</span><span>
</span><span id="line-204"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GlobalAlloc&quot;</span><span>
</span><span id="line-205"></span><span>  </span><span class="hs-identifier">c_GlobalAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span class="hs-comment">-- %fun GlobalDiscard :: HGLOBAL -&gt; IO HGLOBAL</span><span>
</span><span id="line-208"></span><span class="hs-comment">-- %fail {res1==NULL}{ErrorWin(&quot;GlobalDiscard&quot;)}</span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span class="hs-identifier">globalFlags</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-211"></span><span class="hs-identifier">globalFlags</span><span> </span><span class="hs-identifier">mem</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-212"></span><span>  </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">gMEM_INVALID_HANDLE</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;GlobalFlags&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GlobalFlags</span><span> </span><span class="hs-identifier">mem</span><span>
</span><span id="line-213"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GlobalFlags&quot;</span><span>
</span><span id="line-214"></span><span>  </span><span class="hs-identifier">c_GlobalFlags</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span class="hs-identifier">globalFree</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-217"></span><span class="hs-identifier">globalFree</span><span> </span><span class="hs-identifier">mem</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-218"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;GlobalFree&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GlobalFree</span><span> </span><span class="hs-identifier">mem</span><span>
</span><span id="line-219"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GlobalFree&quot;</span><span>
</span><span id="line-220"></span><span>  </span><span class="hs-identifier">c_GlobalFree</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span class="hs-identifier">globalHandle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-223"></span><span class="hs-identifier">globalHandle</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-224"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;GlobalHandle&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GlobalHandle</span><span> </span><span class="hs-identifier">addr</span><span>
</span><span id="line-225"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GlobalHandle&quot;</span><span>
</span><span id="line-226"></span><span>  </span><span class="hs-identifier">c_GlobalHandle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span class="hs-identifier">globalLock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-229"></span><span class="hs-identifier">globalLock</span><span> </span><span class="hs-identifier">mem</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-230"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;GlobalLock&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GlobalLock</span><span> </span><span class="hs-identifier">mem</span><span>
</span><span id="line-231"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GlobalLock&quot;</span><span>
</span><span id="line-232"></span><span>  </span><span class="hs-identifier">c_GlobalLock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span class="hs-comment">-- %fun GlobalMemoryStatus :: IO MEMORYSTATUS</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span class="hs-identifier">globalReAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-237"></span><span class="hs-identifier">globalReAlloc</span><span> </span><span class="hs-identifier">mem</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-238"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;GlobalReAlloc&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GlobalReAlloc</span><span> </span><span class="hs-identifier">mem</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-239"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GlobalReAlloc&quot;</span><span>
</span><span id="line-240"></span><span>  </span><span class="hs-identifier">c_GlobalReAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">GlobalAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HGLOBAL</span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span class="hs-identifier">globalSize</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-243"></span><span class="hs-identifier">globalSize</span><span> </span><span class="hs-identifier">mem</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-244"></span><span>  </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-string">&quot;GlobalSize&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GlobalSize</span><span> </span><span class="hs-identifier">mem</span><span>
</span><span id="line-245"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GlobalSize&quot;</span><span>
</span><span id="line-246"></span><span>  </span><span class="hs-identifier">c_GlobalSize</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span class="hs-identifier">globalUnlock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-249"></span><span class="hs-identifier">globalUnlock</span><span> </span><span class="hs-identifier">mem</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-250"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;GlobalUnlock&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GlobalUnlock</span><span> </span><span class="hs-identifier">mem</span><span>
</span><span id="line-251"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GlobalUnlock&quot;</span><span>
</span><span id="line-252"></span><span>  </span><span class="hs-identifier">c_GlobalUnlock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HGLOBAL</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span class="hs-identifier">hEAP_GENERATE_EXCEPTIONS</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span>
</span><span id="line-257"></span><span class="hs-identifier">hEAP_GENERATE_EXCEPTIONS</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-258"></span><span class="hs-identifier">hEAP_NO_SERIALIZE</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span>
</span><span id="line-259"></span><span class="hs-identifier">hEAP_NO_SERIALIZE</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-260"></span><span class="hs-identifier">hEAP_ZERO_MEMORY</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span>
</span><span id="line-261"></span><span class="hs-identifier">hEAP_ZERO_MEMORY</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span class="hs-pragma">{-# LINE 261 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span class="hs-identifier">heapAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-263"></span><span class="hs-identifier">heapAlloc</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-264"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;HeapAlloc&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapAlloc</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">size</span><span>
</span><span id="line-265"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapAlloc&quot;</span><span>
</span><span id="line-266"></span><span>  </span><span class="hs-identifier">c_HeapAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span class="hs-identifier">heapCompact</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-269"></span><span class="hs-identifier">heapCompact</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-270"></span><span>  </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-string">&quot;HeapCompact&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapCompact</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-271"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapCompact&quot;</span><span>
</span><span id="line-272"></span><span>  </span><span class="hs-identifier">c_HeapCompact</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="hs-identifier">heapCreate</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-275"></span><span class="hs-identifier">heapCreate</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">initSize</span><span> </span><span class="hs-identifier">maxSize</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-276"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;HeapCreate&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapCreate</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">initSize</span><span> </span><span class="hs-identifier">maxSize</span><span>
</span><span id="line-277"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapCreate&quot;</span><span>
</span><span id="line-278"></span><span>  </span><span class="hs-identifier">c_HeapCreate</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-279"></span><span>
</span><span id="line-280"></span><span class="hs-identifier">heapDestroy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-281"></span><span class="hs-identifier">heapDestroy</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-282"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;HeapDestroy&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapDestroy</span><span> </span><span class="hs-identifier">heap</span><span>
</span><span id="line-283"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapDestroy&quot;</span><span>
</span><span id="line-284"></span><span>  </span><span class="hs-identifier">c_HeapDestroy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-285"></span><span>
</span><span id="line-286"></span><span class="hs-identifier">heapFree</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-287"></span><span class="hs-identifier">heapFree</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-288"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;HeapFree&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapFree</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">addr</span><span>
</span><span id="line-289"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapFree&quot;</span><span>
</span><span id="line-290"></span><span>  </span><span class="hs-identifier">c_HeapFree</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span class="hs-identifier">heapLock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-293"></span><span class="hs-identifier">heapLock</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-294"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;HeapLock&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapLock</span><span> </span><span class="hs-identifier">heap</span><span>
</span><span id="line-295"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapLock&quot;</span><span>
</span><span id="line-296"></span><span>  </span><span class="hs-identifier">c_HeapLock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span class="hs-identifier">heapReAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-299"></span><span class="hs-identifier">heapReAlloc</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-300"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;HeapReAlloc&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapReAlloc</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span>
</span><span id="line-301"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapReAlloc&quot;</span><span>
</span><span id="line-302"></span><span>  </span><span class="hs-identifier">c_HeapReAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span class="hs-identifier">heapSize</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-305"></span><span class="hs-identifier">heapSize</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-306"></span><span>  </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-string">&quot;HeapSize&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapSize</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">addr</span><span>
</span><span id="line-307"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapSize&quot;</span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-identifier">c_HeapSize</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span class="hs-identifier">heapUnlock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-311"></span><span class="hs-identifier">heapUnlock</span><span> </span><span class="hs-identifier">heap</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-312"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;HeapUnlock&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_HeapUnlock</span><span> </span><span class="hs-identifier">heap</span><span>
</span><span id="line-313"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapUnlock&quot;</span><span>
</span><span id="line-314"></span><span>  </span><span class="hs-identifier">c_HeapUnlock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-315"></span><span>
</span><span id="line-316"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HeapValidate&quot;</span><span>
</span><span id="line-317"></span><span>  </span><span class="hs-identifier">heapValidate</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HeapAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-318"></span><span>
</span><span id="line-319"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">VirtualAllocFlags</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span class="hs-identifier">mEM_COMMIT</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">VirtualAllocFlags</span><span>
</span><span id="line-322"></span><span class="hs-identifier">mEM_COMMIT</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4096</span><span>
</span><span id="line-323"></span><span class="hs-identifier">mEM_RESERVE</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">VirtualAllocFlags</span><span>
</span><span id="line-324"></span><span class="hs-identifier">mEM_RESERVE</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8192</span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span class="hs-pragma">{-# LINE 325 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span class="hs-comment">-- % , MEM_TOP_DOWN (not in mingw-20001111 winnt.h)</span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">ProtectFlags</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-329"></span><span>
</span><span id="line-330"></span><span class="hs-identifier">pAGE_READONLY</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-331"></span><span class="hs-identifier">pAGE_READONLY</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-332"></span><span class="hs-identifier">pAGE_READWRITE</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-333"></span><span class="hs-identifier">pAGE_READWRITE</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-334"></span><span class="hs-identifier">pAGE_EXECUTE</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-335"></span><span class="hs-identifier">pAGE_EXECUTE</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-336"></span><span class="hs-identifier">pAGE_EXECUTE_READ</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-337"></span><span class="hs-identifier">pAGE_EXECUTE_READ</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-338"></span><span class="hs-identifier">pAGE_EXECUTE_READWRITE</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-339"></span><span class="hs-identifier">pAGE_EXECUTE_READWRITE</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-340"></span><span class="hs-identifier">pAGE_GUARD</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-341"></span><span class="hs-identifier">pAGE_GUARD</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">256</span><span>
</span><span id="line-342"></span><span class="hs-identifier">pAGE_NOACCESS</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-343"></span><span class="hs-identifier">pAGE_NOACCESS</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-344"></span><span class="hs-identifier">pAGE_NOCACHE</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-345"></span><span class="hs-identifier">pAGE_NOCACHE</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">512</span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span class="hs-pragma">{-# LINE 340 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-340"></span><span>
</span><span id="line-341"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">FreeFlags</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-342"></span><span>
</span><span id="line-343"></span><span class="hs-identifier">mEM_DECOMMIT</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FreeFlags</span><span>
</span><span id="line-344"></span><span class="hs-identifier">mEM_DECOMMIT</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16384</span><span>
</span><span id="line-345"></span><span class="hs-identifier">mEM_RELEASE</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FreeFlags</span><span>
</span><span id="line-346"></span><span class="hs-identifier">mEM_RELEASE</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32768</span><span>
</span><span id="line-347"></span><span>
</span><span id="line-348"></span><span class="hs-pragma">{-# LINE 347 &quot;libraries\\Win32\\System\\Win32\\Mem.hsc&quot; #-}</span><span>
</span><span id="line-347"></span><span>
</span><span id="line-348"></span><span class="hs-identifier">virtualAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">VirtualAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ProtectFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-349"></span><span class="hs-identifier">virtualAlloc</span><span> </span><span class="hs-identifier">addt</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-350"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;VirtualAlloc&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_VirtualAlloc</span><span> </span><span class="hs-identifier">addt</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-351"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualAlloc&quot;</span><span>
</span><span id="line-352"></span><span>  </span><span class="hs-identifier">c_VirtualAlloc</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-353"></span><span>
</span><span id="line-354"></span><span class="hs-identifier">virtualAllocEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">VirtualAllocFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ProtectFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-355"></span><span class="hs-identifier">virtualAllocEx</span><span> </span><span class="hs-identifier">proc</span><span> </span><span class="hs-identifier">addt</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-356"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;VirtualAllocEx&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_VirtualAllocEx</span><span> </span><span class="hs-identifier">proc</span><span> </span><span class="hs-identifier">addt</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-357"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualAllocEx&quot;</span><span>
</span><span id="line-358"></span><span>  </span><span class="hs-identifier">c_VirtualAllocEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Addr</span><span>
</span><span id="line-359"></span><span>
</span><span id="line-360"></span><span class="hs-identifier">virtualFree</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FreeFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-361"></span><span class="hs-identifier">virtualFree</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-362"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;VirtualFree&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_VirtualFree</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-363"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualFree&quot;</span><span>
</span><span id="line-364"></span><span>  </span><span class="hs-identifier">c_VirtualFree</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FreeFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-365"></span><span>
</span><span id="line-366"></span><span class="hs-identifier">virtualFreeEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FreeFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-367"></span><span class="hs-identifier">virtualFreeEx</span><span> </span><span class="hs-identifier">proc</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-368"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;VirtualFreeEx&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_VirtualFreeEx</span><span> </span><span class="hs-identifier">proc</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-369"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualFreeEx&quot;</span><span>
</span><span id="line-370"></span><span>  </span><span class="hs-identifier">c_VirtualFreeEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FreeFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-371"></span><span>
</span><span id="line-372"></span><span class="hs-identifier">virtualLock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-373"></span><span class="hs-identifier">virtualLock</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-374"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;VirtualLock&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_VirtualLock</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span>
</span><span id="line-375"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualLock&quot;</span><span>
</span><span id="line-376"></span><span>  </span><span class="hs-identifier">c_VirtualLock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-377"></span><span>
</span><span id="line-378"></span><span class="hs-identifier">virtualProtect</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ProtectFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-379"></span><span class="hs-identifier">virtualProtect</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">new_prot</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-380"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_old</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-381"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;VirtualProtect&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_VirtualProtect</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">new_prot</span><span> </span><span class="hs-identifier">p_old</span><span>
</span><span id="line-382"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_old</span><span>
</span><span id="line-383"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualProtect&quot;</span><span>
</span><span id="line-384"></span><span>  </span><span class="hs-identifier">c_VirtualProtect</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-385"></span><span>
</span><span id="line-386"></span><span class="hs-identifier">virtualProtectEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ProtectFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ProtectFlags</span><span>
</span><span id="line-387"></span><span class="hs-identifier">virtualProtectEx</span><span> </span><span class="hs-identifier">proc</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">new_prot</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-388"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_old</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-389"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;VirtualProtectEx&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-390"></span><span>    </span><span class="hs-identifier">c_VirtualProtectEx</span><span> </span><span class="hs-identifier">proc</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">new_prot</span><span> </span><span class="hs-identifier">p_old</span><span>
</span><span id="line-391"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_old</span><span>
</span><span id="line-392"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualProtectEx&quot;</span><span>
</span><span id="line-393"></span><span>  </span><span class="hs-identifier">c_VirtualProtectEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-394"></span><span>
</span><span id="line-395"></span><span class="hs-identifier">virtualQueryEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPVOID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MEMORY_BASIC_INFORMATION</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">SIZE_T</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-396"></span><span class="hs-identifier">virtualQueryEx</span><span> </span><span class="hs-identifier">hProcess</span><span> </span><span class="hs-identifier">lpAddress</span><span> </span><span class="hs-identifier">lpBuffer</span><span> </span><span class="hs-identifier">dwLength</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-397"></span><span>  </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-string">&quot;VirtualQueryEx&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_VirtualQueryEx</span><span> </span><span class="hs-identifier">hProcess</span><span> </span><span class="hs-identifier">lpAddress</span><span> </span><span class="hs-identifier">lpBuffer</span><span> </span><span class="hs-identifier">dwLength</span><span>
</span><span id="line-398"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualQueryEx&quot;</span><span>
</span><span id="line-399"></span><span>  </span><span class="hs-identifier">c_VirtualQueryEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPVOID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MEMORY_BASIC_INFORMATION</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">SIZE_T</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-400"></span><span>
</span><span id="line-401"></span><span class="hs-identifier">virtualUnlock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-402"></span><span class="hs-identifier">virtualUnlock</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-403"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;VirtualUnlock&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_VirtualUnlock</span><span> </span><span class="hs-identifier">addr</span><span> </span><span class="hs-identifier">size</span><span>
</span><span id="line-404"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h VirtualUnlock&quot;</span><span>
</span><span id="line-405"></span><span>  </span><span class="hs-identifier">c_VirtualUnlock</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-406"></span></pre></body></html>